/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.view;

import com.model.Paket;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author ryulong
 */
public class model_menu extends AbstractTableModel {

    private List<Paket> kategoris = new ArrayList<Paket>();

    public model_menu(List<Paket> kategoris) {
        this.kategoris = kategoris;
    }

    public int getRowCount() {
        return kategoris.size();
    }

    public int getColumnCount() {
        return 7;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Paket b = kategoris.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return b.getNamaPaket();
            case 1:
                return b.getHargaPaket();
            case 2:
                return b.getNasi();
            case 3:
                return b.getLauk();
            case 4:
                return b.getSayur();
            case 5:
                return b.getKrupuk();
            case 6:
                return b.getMinum();
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "nama paket";
            case 1:
                return "harga";
            case 2:
                return "nasi";
            case 3:
                return "lauk";
            case 4:
                return "sayur";
            case 5:
                return "krupuk";
            case 6:
                return "minum";
            default:
                return "";
        }
    }
}
